

using System.Linq;
using Abp;
using Abp.Authorization;
using Abp.Configuration.Startup;
using Abp.Localization;
using Abp.MultiTenancy;
using WebApp.Authorization;

namespace WebApp.Authorization
{
    /// <summary>
    /// 权限配置都在这里。
    /// 给权限默认设置服务
    /// See <see cref="UiMenuPermissions" /> for all permission names. UiMenu
    ///</summary>
    public class UiMenuAuthorizationProvider : AuthorizationProvider
    {
        private readonly bool _isMultiTenancyEnabled;

		public UiMenuAuthorizationProvider()
		{

		}

       
        public UiMenuAuthorizationProvider(bool isMultiTenancyEnabled)
        {
            _isMultiTenancyEnabled = isMultiTenancyEnabled;
        }

        public UiMenuAuthorizationProvider(IMultiTenancyConfig multiTenancyConfig)
        {
            _isMultiTenancyEnabled = multiTenancyConfig.IsEnabled;
        }

		public override void SetPermissions(IPermissionDefinitionContext context)
		{
			// 在这里配置了UiMenu 的权限。
		

			context.CreatePermission(UiMenuPermissions.Node, L("UiMenu"));
			context.CreatePermission(UiMenuPermissions.Query, L("QueryUiMenu"));
			context.CreatePermission(UiMenuPermissions.Create, L("CreateUiMenu"));
			context.CreatePermission(UiMenuPermissions.Edit, L("EditUiMenu"));
			context.CreatePermission(UiMenuPermissions.Delete, L("DeleteUiMenu"));
			context.CreatePermission(UiMenuPermissions.BatchDelete, L("BatchDeleteUiMenu"));
			context.CreatePermission(UiMenuPermissions.ExportExcel, L("ExportToExcel"));


			//// custom codes



			//// custom codes end
		}

		private static ILocalizableString L(string name)
		{
			return new LocalizableString(name, AbpConsts.LocalizationSourceName);
		}
    }
}
